/*
 * IkaGraphic.cpp
 */

#include "IkaGraphic.h"
#include <iostream>

using namespace atomic;
using namespace std;

namespace atomic {


//*********************************************************************
IkaGraphic::IkaGraphic() {
	Init();
}

//*********************************************************************
IkaGraphic::IkaGraphic(string imageName) {
	Init();
	LoadFile(imageName.c_str());
}

//*********************************************************************
IkaGraphic::IkaGraphic(char* name) {
	Init();
	LoadFile(name);
}

//*********************************************************************
IkaGraphic::IkaGraphic(const IkaGraphic & copy){
	Init();
	myImage = new sf::Image(*(copy.myImage));
	mySprite = new sf::Sprite(*(copy.mySprite));
}

//*********************************************************************
IkaGraphic::~IkaGraphic() {
	delete myImage;
	delete mySprite;
}

//*********************************************************************
void IkaGraphic::LoadFile(const char* imageName) {
	if( !myImage->LoadFromFile(imageName) ){
		cout<< "image loading problem" <<endl;;
	}
	mySprite->SetImage(*myImage);
}

//*********************************************************************
void IkaGraphic::Init() {
	myImage = new sf::Image();
	mySprite = new sf::Sprite();
}


//*********************************************************************
IkaGraphic& IkaGraphic::operator=(const IkaGraphic& graphic) {
	myImage = new sf::Image(*(graphic.myImage));
		mySprite = new sf::Sprite(*(graphic.mySprite));
	return *this;
}

//*********************************************************************
sf::Sprite& IkaGraphic::Sprite(){
	return *mySprite;
}

//*********************************************************************
}
